package cloudgamesaumysql

import (
	"github.com/shopspring/decimal"
	"gorm.io/gorm"
	"time"
)

/*
  @author liubogeng
  @date   2025/4/7 13:41
*/

// CGGameAUUserTransactionOfDirectPurchase 云游戏直购记录表
type CGGameAUUserTransactionOfDirectPurchase struct {
	ID                           int64           `json:"id" gorm:"column:id;type:bigint;primaryKey;autoIncrement;comment:ID"`
	TransactionOrderNumber       string          `json:"transaction_order_number" gorm:"column:transaction_order_number;type:varchar(128);default:'';not null;comment:充值订单单号"`
	AUSideTransactionOrderNumber string          `json:"au_side_transaction_order_number" gorm:"column:au_side_transaction_order_number;type:varchar(128);default:'';not null;comment:AU侧订单单号"`
	RechargeType                 string          `json:"recharge_type" gorm:"column:recharge_type;type:varchar(32);default:'';not null;comment:充值类型，目前有 平台，劲舞团，直购"`
	TopUpPlatform                string          `json:"top_up_platform" gorm:"column:top_up_platform;type:varchar(32);not null;default:'';comment:充值平台，微信/支付宝"`
	UserID                       int64           `json:"user_id" gorm:"column:user_id;type:bigint;not null;default:0;comment:用户ID"`
	Phone                        string          `json:"phone" gorm:"column:phone;type:varchar(20);not null;default:'';comment:用户手机号"`
	ItemName                     string          `json:"item_name" gorm:"column:item_name;type:varchar(64);default:'';not null;comment:道具名称"`
	TransactionAmount            decimal.Decimal `json:"transaction_amount" gorm:"column:transaction_amount;type:decimal(12,2);not null;default:0.00;comment:交易金额"`
	TransactionStatus            int             `json:"transaction_status" gorm:"column:transaction_status;type:tinyint;not null;default:0;comment:交易状态 0为待付款 1为已超时 2已取消 8已付款 9支付中 10已关闭"`
	PayingTime                   time.Time       `json:"paying_time" gorm:"column:paying_time;type:datetime;default:null;comment:订单的交易状态转为 正在支付 的时间戳"`
	IsSynchronized               int             `json:"is_synchronized" gorm:"column:is_synchronized;type:tinyint;not null;default:0;comment:与第三方对接的同步状态 0未同步 1已同步"`
	SynchronizedTime             time.Time       `json:"synchronized_time" gorm:"column:synchronized_time;type:datetime;default:null;comment:与第三方对接的同步时间"`
	//CauseOfFailure    string         `json:"cause_of_failure" gorm:"column:cause_of_failure;type:varchar(500);not null;default:'';comment:交易失败原因"`
	IsRefund                  int             `json:"is_refund" gorm:"column:is_refund;type:tinyint;not null;default:0;comment:是否退款 0未退款 1部分退款 2全额退款"`
	RefundedTransactionAmount decimal.Decimal `json:"refunded_transaction_amount" gorm:"column:refunded_transaction_amount;type:decimal(12,2);not null;default:0.00;comment:已退款金额"`
	//CauseOfRefund string         `json:"cause_of_refund" gorm:"column:cause_of_refund;type:varchar(500);not null;default:'';comment:退款原因"`
	AbleRefundTransactionAmount decimal.Decimal `json:"able_refund_transaction_amount" gorm:"column:able_refund_transaction_amount;type:decimal(12,2);not null;default:0.00;comment:可退款金额"`
	IsMonthCard                 int             `json:"is_month_card" gorm:"column:is_month_card;type:tinyint;not null;default:0;comment:月卡 0不是 1是"`
	//RefundTransactionAmount     decimal.Decimal `json:"refund_transaction_amount" gorm:"column:refund_transaction_amount;type:decimal(12,2);not null;default:0.00;comment:实际退款金额"`
	CreatedAt time.Time      `json:"created_at" gorm:"column:created_at;type:datetime;comment:该条记录创建时间"`
	UpdatedAt time.Time      `json:"updated_at" gorm:"column:updated_at;type:datetime;comment:该条记录修改时间"`
	DeletedAt gorm.DeletedAt `json:"-" gorm:"index;type:datetime;comment:该条记录删除时间"`
}

func (CGGameAUUserTransactionOfDirectPurchase) TableName() string {
	return "cg_game_au_user_transaction_of_direct_purchase"
}
